﻿
/*
 * Create table UDS_MailGroupMember
 */
IF ( OBJECT_ID(N'dbo.UDS_MailGroupMember', N'U') IS NULL )
BEGIN
    CREATE TABLE dbo.UDS_MailGroupMember
    (
        GroupID     int             NOT NULL,
        UserName    nvarchar(50)    COLLATE Chinese_PRC_CI_AS NOT NULL,
        TimeCreated datetime        NOT NULL CONSTRAINT [DF_UDS_MailGroupMember_TimeCreated] DEFAULT(getdate()),

        CONSTRAINT [PK_UDS_MailGroupMember] PRIMARY KEY CLUSTERED ( GroupID asc, UserName asc ),
        CONSTRAINT [FK_UDS_MailGroupMember_GroupID] FOREIGN KEY (GroupID) REFERENCES dbo.UDS_MailGroup(GroupID),
        CONSTRAINT [FK_UDS_MailGroupMember_UserName] FOREIGN KEY (UserName) REFERENCES dbo.UDS_Staff(Staff_Name)
    );
END
GO
